<template>
  <div class="withdrawColumnAmountInfo headUser_bg">
    <div class="withdraw_amount">
      <div class="l_box">
        <div>
          {{ userLang.tip }}
          <div class="refresh" @click="refresh">
            <NuxtImg
              :class="{ refreshing: isRefresh }"
              src="/images/layout/Icon_Refresh3.png"
            />
          </div>
        </div>
        <div style="color: #ffd700">
          {{ userStore.moneyUnit }} {{ money_1 }}
        </div>
      </div>
      <div class="r_box">
        <div style="color: #ffa200">
          <span>{{ userLang.card_text }}</span>
          <span>
            {{ userStore.moneyUnit }} {{ money_2 }}/{{ userStore.moneyUnit }}
            {{ money_3 }}
          </span>
        </div>
        <div class="el-progress el-progress--line el-progress_box">
          <div class="el-progress-bar">
            <div class="el-progress-bar__outer" style="height: 18px">
              <div
                class="el-progress-bar__inner"
                :style="`
                    width: ${progress}%;
                    animation-duration: 3s;
                    background-color: rgb(240, 165, 34);
                  `"
              ></div>
            </div>
          </div>
          <div class="el-progress__text" style="font-size: 19.2px">
            <span>{{ progress }}%</span>
          </div>
        </div>
        <div class="limpar_btn_max_box">
          <div
            class="limpar_btn btn limpar_btn_false"
            v-click-move
            @click="showMsg"
          >
            <span style="color: #86edf5">{{ userLang.zero_btn }}</span>
            <NuxtImg src="/images/layout/Icon_Que.png" class="logo-question" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
const [userLang]: any = await Promise.all([getCurrentPageLang("user")]);

const userStore = useUserStore();

const money_1 = ref("0.00");
const money_2 = ref("0.00");
const money_3 = ref("0.00");
const progress = ref(40);

function showMsg() {
  showDialog({
    title: userLang.card_tip_title,
    message: userLang.card_tip_text,
    destroyOnClose: true,
    className: "custom-dialog",
    showConfirmButton: false,
    showCancelButton: true,
  });
}

// 刷新
const isRefresh = ref(false);
function refresh() {
  if (isRefresh.value) return;
  isRefresh.value = true;
  setTimeout(() => {
    isRefresh.value = false;
  }, 2000);
}
</script>

<style scoped lang="scss">
.withdrawColumnAmountInfo {
  --6bf0a2cc: url("/images/user/account_bg_01.png");
  margin: 0.4rem auto 0.2rem;
  padding: 0.3rem 0.48rem;
  white-space: normal;
  border-radius: 0.2rem;
  color: var(--theme-neutral1);
  background: var(--6bf0a2cc);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.withdrawColumnAmountInfo .withdraw_amount {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.withdrawColumnAmountInfo .withdraw_amount .l_box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.4rem;
  font-weight: 300;
}
.withdrawColumnAmountInfo .withdraw_amount > div {
  padding: 0.2rem 0rem;
  border-radius: 0.22rem;
  text-align: center;
  box-sizing: border-box;
  width: 100%;
}
.withdrawColumnAmountInfo .withdraw_amount .l_box div:nth-child(1) {
  white-space: normal;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.16rem;
}
.withdrawColumnAmountInfo .withdraw_amount .l_box div:nth-child(1) {
  white-space: normal;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.16rem;
}
.withdrawColumnAmountInfo .withdraw_amount .l_box .refresh {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 1rem;
  margin: auto;
  font-size: 0.4rem;
  img {
    width: 0.5rem;
    height: 0.5rem;
  }
}

.withdrawColumnAmountInfo .withdraw_amount > div {
  padding: 0.2rem 0rem;
  border-radius: 0.22rem;
  text-align: center;
  box-sizing: border-box;
  width: 100%;
}
.withdrawColumnAmountInfo .withdraw_amount .r_box {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.1rem;
  padding: 0;
  font-size: var(--font-size2);
}
.withdrawColumnAmountInfo .withdraw_amount .r_box > div {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
}
.withdrawColumnAmountInfo .withdraw_amount .r_box > div {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
}
.el-progress {
  align-items: center;
  display: flex;
  line-height: 1;
  position: relative;
}
.el-progress_box {
  margin-top: 0.1rem;
}
.el-progress-bar {
  box-sizing: border-box;
  flex-grow: 1;
}
.el-progress_box .el-progress-bar__outer {
  background: var(--app-bg-color);
  height: 0.2rem !important;
}
.el-progress-bar__outer {
  background-color: var(--el-border-color-lighter);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
  position: relative;
  vertical-align: middle;
}
.el-progress_box .el-progress-bar__outer .el-progress-bar__inner {
  background-color: var(--theme-dec4) !important;
}
.el-progress-bar__inner {
  background-color: var(--el-color-primary);
  border-radius: 100px;
  height: 100%;
  left: 0;
  line-height: 1;
  position: absolute;
  text-align: right;
  top: 0;
  transition: width 0.6s ease;
  white-space: nowrap;
}
.el-progress_box .el-progress__text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: auto !important;
  font-size: 0.277rem !important;
  color: var(--theme-neutral1) !important;
}
.el-progress__text {
  color: var(--el-text-color-regular);
  font-size: 14px;
  line-height: 1;
  margin-left: 5px;
  min-width: 50px;
}
.withdrawColumnAmountInfo .withdraw_amount .r_box > div {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
}
.limpar_btn_max_box {
  margin-top: 0.2rem;
  display: flex;
  justify-content: flex-end !important;
  gap: 8px;
}
.limpar_btn_max_box .limpar_btn {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.1rem;
  font-weight: 100;
  border-radius: 0.4rem;
  font-size: 0.28rem;
  padding: 0.08rem 0.2rem;
  background: var(--theme-neutral5);
}
.btn {
  cursor: pointer;
}
.logo-question {
  width: 0.4rem;
}
</style>
